<?php
if(have_posts())
{
	while (have_posts())
	{
		the_post();
		$meta_key = $wpdb->prefix.'thumbnail';
		
		$post_id = get_the_ID();
		$title = get_the_title($post_id);
		$perlink = '';
		$thumbnail = db_get_post_meta($post_id, $meta_key);
		$alt = db_get_alt_attachment_id($post_id, $meta_key);
		if(!$alt)
			$alt = db_vietnamese_slug($title);
		$myurl = get_post_meta($post_id,$wpdb->prefix.'url',true);	
		//print_r($myurl);
		if($myurl)
			$perlink = $myurl;
		else 
			$perlink = get_bloginfo('home');
		$text_intro = get_post_meta($post_id,$wpdb->prefix.'text-intro',true);
		?>
		 <li>
	            	<a href="<?php echo $perlink;?>">
	              <div class="khung_ngoai">
	                <div class="hinh_anh">
	                <img src="<?php bloginfo('stylesheet_directory'); ?>/timthumb.php?src=<?php echo $thumbnail;?>&w=215&h=121" border="0" " alt="<?php echo $alt;?>"/>
	                </div>
	                <!-- end .hinh_anh-->
	                <div class="tieu_de">
	                  <h4><?php echo db_shortDesc($text_intro, 30);?></h4>
	                </div>
	                <!-- end .tieu_de-->
	                <div class="tom_tat"><?php echo db_shortDesc($title, 30);?></div>
	                <!-- end .tom_tat-->
	              </div>
	              <!-- end .khung_ngoai-->
	              	</a>
	         </li>  
		<?php 
	}
}
else 
{
?>
	<li> Không có bài viết ! </li>
<?php 	
}